package com.sec.otc.odbc.controller;
import java.util.List;
import java.util.Map;


import com.alibaba.fastjson.JSONObject;
import com.sec.otc.odbc.service.OdbcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.CannotGetJdbcConnectionException;
import org.springframework.stereotype.Component;

/**
 *
 *
 */
@Component
public class CollectDataMaster implements InitializingBean {

	private final static Logger logger = LoggerFactory.getLogger(CollectDataMaster.class);

	@Autowired
	private OdbcService odbcService;


    @Override
	public void afterPropertiesSet() throws Exception {

   	try {
		List<Map<String, Object>> data=odbcService.queryData();
		for(Map<String, Object> map:data){
			logger.info("get data={}",JSONObject.toJSONString(map));
		}


		} catch (CannotGetJdbcConnectionException e) {
			logger.error("SQL SERVER连接失败, 请检查SQL SERVER是否连接正常...");
		} catch (Exception e) {
			logger.error(e.getMessage());
		}

		// 实时同步事件数据 日数据
	
	}

	
}
